#define _CRT_SECURE_NO_WARNINGS 1
void rotate(int* nums, int numsSize, int k) {
    /*int i,j;
    int new[numsSize];
    for(i=0;i<numsSize;i++)
       new[(i+k)%numsSize]=nums[i];
    for(i=0;i<numsSize;i++)
        nums[i]=new[i];*/

    k %= numsSize;
    reverse(nums, 0, numsSize - k - 1);
    reverse(nums, numsSize - k, numsSize - 1);
    reverse(nums, 0, numsSize - 1);
}

void reverse(int* a, int left, int right) {
    int t;
    while (left < right)
    {
        t = a[left];
        a[left] = a[right];
        a[right] = t;
        left++;
        right--;
    }
}